@isTest(SeeAllData=true)
private class AddParticipantToCourseTestClass {
    static testMethod void ValideAddParticipantToCourseController() {
		User usr;
		Course__c crso;
		Course_participant__c courPrtct = new Course_participant__c();
		
		PageReference currentPage = Page.AddParticipantToCourse;
		Test.setCurrentPage(currentPage);
		
		
		
		AddParticipantToCourseController AdPtTCC = new AddParticipantToCourseController();
		//AdPtTCC.course = 'Curso Prueba 15-11-12';
		//AdPtTCC.dueDate = '18/12/2012/';
		//List<Course_participant__c> testing = new List<Course_participant__c>();
		
		/*for(Integer i =0; i<10; i++){
			usr = new User();
			usr.CommunityNickname = 'Test User Nickname No '+i;
	        usr.CurrencyIsoCode = 'USD';
	        usr.DigestFrequency = 'N';
	        usr.DefaultGroupNotificationFrequency = 'N'; 
	        usr.Email = 'email'+i+'_user@test.com';
	        usr.EmailEncodingKey = 'UTF-8';
	        usr.Firstname = 'Test User FirstName No ' + i;
	        usr.IsActive = true;
	        usr.Lastname = 'Test User LastName No ' + i;
			insert usr;
		}
		

		for(Integer i =0; i<2; i++){
			crso = new Course__c();
			crso.Name = 'Test Course Name ' + i;
			crso.Description__c = 'Test Course Description ' + i;
			crso.Active__c = true;
			insert crso;
		}
		
	*/
		
		//Profile Prfl = new Profile(name='Custom - Portal Employee');
		//Prfl.Id = '00eL0000000QKIn';
		//insert Prfl;
		
		//Profile prfl = new Profile (name = 'Custom - Portal Employee');
        //insert prfl;
        
        Profile prfl = [SELECT	name,id
        				FROM	Profile
        				WHERE	name = 'Custom - Portal Employee'];
        
        
		
		usr=[	SELECT 	AboutMe, IsActive, UserPreferencesActivityRemindersPopup, ReceivesAdminInfoEmails, Alias, 
						ForecastEnabled, UserPermissionsMobileUser, UserPreferencesApexPagesDeveloperMode, 
						Approved_Time_Off__c, Attendance_Checked__c, UserPermissionsCallCenterAutoLogin, 
						UserPermissionsAvantgoUser, CallCenterId, MobilePhone, City, CommunityNickname, CompanyName, 
						ContactId, Country, CreatedById, CreatedDate, CurrencyIsoCode, EDY_ORGCUSTOM__DB__c, 
						DefaultCurrencyIsoCode, DelegatedApproverId, Department,
						UserPreferencesDisableAutoSubForFeeds, Division, Email, EmailEncodingKey, AccountId, 
						EmployeeNumber, UserPreferencesEventRemindersCheckboxDefault, Extension, Fax, FirstName, 
						Name, InCourse__c, Inattendance_On_7_Days__c, ReceivesInfoEmails, IsPortalEnabled, 
						UserPermissionsKnowledgeUser, LanguageLocaleKey, LastLoginDate, LastModifiedById, 
						LastModifiedDate, LastName, LastPasswordChangeDate, LocaleSidKey, ManagerId, 
						UserPermissionsMarketingUser, ORGCUSTOM4_DB__c, ORGCUSTOM4_OLD_FIRST_NAME__c, 
						ORGCUSTOM4_OLD_LAST_NAME__c, OfflineTrialExpirationDate, UserPermissionsOfflineUser, 
						EDY_ORGCUSTOM__Old_First_Name__c, EDY_ORGCUSTOM__Old_Last_Name__c, 
						UserPreferencesOptOutOfTouch, Phone, PortalRole, ProfileId, UserPreferencesReminderSoundOff, 
						UserRoleId, OfflinePdaTrialExpirationDate, UserPermissionsSFContentUser, 
						IsPortalSelfRegistered, State, Street, SystemModstamp, 
						UserPreferencesTaskRemindersCheckboxDefault, TimeZoneSidKey, Title, Id, UserType, Username, 
						Working_Hours__c, PostalCode 
				FROM 	User
				WHERE	ProfileId =: prfl.Id
				LIMIT 	1];
		
		/*String ideProf = prfl.id;
		
		Test.startTest();
		usr = new User();
		usr.CommunityNickname = 'TestUserNickname';
	    usr.CurrencyIsoCode = 'USD';
	    usr.DigestFrequency = 'N';
	    usr.DefaultGroupNotificationFrequency = 'N'; 
	    usr.Email = 'email_user@test.com';
	    usr.EmailEncodingKey = 'UTF-8';
	    usr.Firstname = 'TestUserFirstName';
	    usr.IsActive = true;
	    usr.Lastname = 'TestUserLastName';
	    //usr.ProfileId = prfl.id;
		usr.Username = '_newsft@gmail.com';
		usr.Alias = 'nnew';
		//usr.TimeZoneSidKey = 'America/Mexico_City';
		//usr.LocaleSidKey = 'es_MX';
		usr.LanguageLocaleKey = 'en_US';
		
		usr.LocaleSidKey='en_US';
        usr.ProfileId = prfl.id; 
        usr.TimeZoneSidKey='America/New_york';
        
        
		//usr.Id='005E00000021rKUIAY';
		
		        
        user.ContactId = '';*/
        //user.CommunityNickname = account.PersonEmail;
        //user.CurrencyIsoCode='USD';
        //user.DigestFrequency='N';
        //user.DefaultGroupNotificationFrequency='N'; 
        //user.Email =account.PersonEmail;
        //user.EmailEncodingKey='UTF-8';
        //ser.Firstname = account.firstname;
        //user.IsActive=true;
        //user.Lastname = account.lastname;
        //user.LanguageLocaleKey='en_US';
        //user.LocaleSidKey='en_US';
        //user.ProfileID = '00eL0000000QKIn'; 
        //user.TimeZoneSidKey='America/New_york';
        //user.Username = account.PersonEmail;   
		
		
		
		//insert usr;
		
		crso = new Course__c();
		crso.Name = 'Test Course Name';
		crso.Description__c = 'Test Course Description';
		crso.Active__c = true;
		insert crso;
		
		System.debug('-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-'+crso.Id);
				
		AdPtTCC.getCrsPtcpt();
		
		courPrtct.Course__c = crso.Id;
		courPrtct.Course_participant__c = usr.Id;
		courPrtct.Due_date__c = Date.parse('12/12/2012');
		
		
		
		//insert courPrtct;
		
		AdPtTCC.setSearchText('');
		AdPtTCC.getSearchText();
		AdPtTCC.setCrsPtcpt(courPrtct);
		AdPtTCC.getCrsPtcpt();
		AdPtTCC.getResults();
		AdPtTCC.doSearch2();//checar
		AdPtTCC.cancel();
		
		List<User> addUsrTest = [SELECT id FROM user LIMIT 10];
		List<User> removeUsrTest = [SELECT id FROM user LIMIT 5];
		
		String addUsr;
		String removeUsr;
		
		//AdPtTCC.addMembersToCourse();
				
		for(User tempUsr : addUsrTest){
				addUsr = addUsr + tempUsr.Id +',';
		}
		for(User tempUsr : removeUsrTest){
				removeUsr = removeUsr + tempUsr.Id +',';
		}
		Apexpages.currentPage().getParameters().put('unitedListAdd',addUsr);
		Apexpages.currentPage().getParameters().put('unitedListRemove',removeUsr);
		Apexpages.currentPage().getParameters().put('course','Curso Prueba 15-11-12');
		Apexpages.currentPage().getParameters().put('dueDate','19/12/2012');
		
		AdPtTCC.addMembersToCourse();
		
		
	}
}